/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package phan.connection;
import java.io.File;
/**
 *
 * @author bailleurs services
 */
public class renameFile {

    public renameFile(){

    }
    public void renameFile(String file, String toFile) {

        File toBeRenamed = new File(file);

        if (!toBeRenamed.exists() || toBeRenamed.isDirectory()) {

            System.out.println("File does not exist: " + file);
            return;
        }

        File newFile = new File(toFile);

        //Rename
        if (toBeRenamed.renameTo(newFile)) {
            System.out.println("File has been renamed.");
        } else {
            System.out.println("Error renmaing file");
        }


    }
}
